/* eslint-disable */
/**
 * 复制对象属性
 *
 * @param {Object} target 目标对象
 * @param {Object} source 源对象
 */
function mergeObject(target, source) {
    let obj = target;
    for (let key in source) {
        obj[key] = source[key];
    }

    return obj;
}

/**
 * 将对象数组集合属性复制到目标对象
 * @param {Object} target 目标对象
 * @param {array} array 源对象数组
 */
function mergeObjectByArray(target, array) {

    let obj = target;

    for (let i = 0, len = array.length; i < len; i += 1) {
        obj = mergeObject(obj, array[i]);
    }

    return obj;
}

export {
    mergeObject,
    mergeObjectByArray,
};
